package com.homelock.constants;

public enum UnlockAttributeEnum {
  
  NORMAL((byte)0, "普通开锁方式"),
  SUPER_ADMIN((byte)1, "超级管理员(门锁初始化时)的开锁方式"),
  ALARM((byte)2, "带报警属性的开锁方式"),
  ;
  
  private byte attribute;
  private String desc;
  UnlockAttributeEnum(byte attribute, String desc) {
    this.attribute = attribute;
    this.desc = desc;
  }
  public byte getAttribute() {
    return attribute;
  }
  public String getDesc() {
    return desc;
  }
  
  public static UnlockAttributeEnum getUnlockAttributeEnum(Integer attribute) {
    if(null == attribute) {
      return null;
    }
    for(UnlockAttributeEnum unlockAttributeEnum : values()) {
      if(unlockAttributeEnum.getAttribute() == attribute.byteValue()) {
        return unlockAttributeEnum;
      }
    }
    return null;
  }
}
